import 'package:flutter/material.dart';
import 'package:hao_ke/utils/order_state_util.dart';
import 'package:hao_ke/widgets/title_content.dart';

class OrderItemWidget extends StatelessWidget {
  final String projectName;

  final String? serviceDate;

  final String orderNo;

  final String? employeeName;

  final String? amount;

  final String? userName;

  final String? phone;

  final String state;

  OrderItemWidget(this.projectName,this.orderNo,this.amount,this.userName,this.phone,this.state, {this.serviceDate, this.employeeName});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){
        Navigator.of(context).pushNamed('/room/$orderNo');
      },
      child: Container(
        height: 240,
        margin: const EdgeInsets.only(left: 10,right: 10,top: 5),
        decoration: BoxDecoration(
          color: const Color.fromRGBO(200, 200, 200, 0.2),
          borderRadius: BorderRadius.circular(10),
        ),
        child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                height: 40,
                padding: const EdgeInsets.only(left: 10,),
                decoration: const BoxDecoration(
                    color: Color.fromRGBO(200, 200, 200, 0.2),
                    borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(10),
                      topRight: Radius.circular(10),
                    )
                ),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(
                      projectName,
                      style:
                      const TextStyle(fontSize: 18,fontWeight: FontWeight.w500,color: Colors.black),
                    ),
                    StateUtil(state: state),
                    Container(
                        padding: const EdgeInsets.only(right: 10),
                        child: Text('价格：$amount',style: const TextStyle(color: Colors.black38))
                    ),
                  ],
                ),
              ),
              Container(
                padding: const EdgeInsets.all(10),
                child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      TitleContent("订单号", orderNo),
                      TitleContent("服务时间", serviceDate.toString()),
                      TitleContent("护理师", employeeName.toString()),
                      TitleContent("用户名", userName.toString()),
                      TitleContent("电话", phone.toString()),
                    ]
                ),
              ),
            ]),
      ),
    );
  }
}
